#    Copyright 2008, 2009 Tri-County Electric Cooperative, St. Matthews, South Carolina
#    This file is part of COOPGIS.
#    COOPGIS is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#    COOPGIS is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#    You should have received a copy of the GNU General Public License
#    along with COOPGIS.  If not, see <http://www.gnu.org/licenses/>.

#************************BEGIN Add Include Files to Path************************
import sys
NeededPaths=['/opt/coopgis/djangoproject/include', '/opt/coopgis/djangoproject']
for path in NeededPaths:
    if(not path in sys.path):
        sys.path.append(path)
#************************END   Add Include Files to Path************************
import COOPGIS_Ajax, COOPGIS_GPS, COOPGIS_Misc, COOPGIS_ReportLab, COOPGIS_String, COOPGIS_Update
import COOPGIS_FormMisc, COOPGIS_FormInventoryCollection, COOPGIS_FormGeography, COOPGIS_FormAssembly
import COOPGIS_DynamicTemplate
import os, csv, shutil, datetime, time, reportlab, djangoproject.settings, random
from django.contrib.gis.db import models
from django.contrib.gis.geos import *
from django.http import HttpResponse
from django.contrib import admin
from django.template import Context, loader
import djangoproject.settings
import _mysql as mysql
from models import *
from django import forms

def InventoryCollection(request):
    ApplicationName=djangoproject.settings.COOPGISInventoryCollectionApplicationName
    UserNameOrIPAddress, DefaultMap=COOPGIS_Misc.GetUserNameOrIPAddress(request, GetDefaultMap=True, ApplicationName=ApplicationName)
    LoginStatus, applicationPermission=COOPGIS_Misc.CheckLoginPermissions(request, ApplicationName) 
    Shortcuts=SetupShortcuts()
    form=COOPGIS_FormMisc.BuildForm(request, ApplicationName, DefaultMap, SpecialBuildFormInfo=Shortcuts)
    if(not applicationPermission):  #Show view of Map and Form if no Permissions, do not perform any form processing
        MapFileName, LayerName=COOPGIS_Misc.GenerateDynamicMapFile(ApplicationName, UserNameOrIPAddress) 
        OpenLayersZoom=COOPGIS_Ajax.GetOpenLayersZoom(None, None)   
        t = loader.get_template('/opt/coopgis/djangoproject/templates/inventorycollection.html')
        c = Context({'OpenLayersZoom': OpenLayersZoom, 'form': form,
                     'MapFileName': MapFileName, 'LayerName': LayerName, 'LoginStatus':LoginStatus})
        return HttpResponse(t.render(c))
    SelectionStation=SelectionSpan=GPSStatus2=''
    COOPGIS_FormGeography.GetAndSetDefaultMap(form, ApplicationName, UserNameOrIPAddress)
    SelectionStation, SelectionSpan, GPSStatus=COOPGIS_FormGeography.SetSelectionStationAndSpan(form)
    SelectionStation, SelectionSpan, GPSStatus2=COOPGIS_FormGeography.CreateStation(form, SelectionStation, SelectionSpan, UserNameOrIPAddress)
    SelectionSpan=COOPGIS_FormGeography.CreateSpan(form, SelectionStation, SelectionSpan, UserNameOrIPAddress)
    COOPGIS_FormGeography.UpdateStationComment(form, SelectionStation, UserNameOrIPAddress)
    COOPGIS_FormGeography.UpdateSpanComment(form, SelectionSpan, UserNameOrIPAddress)
    GPSStatus3, SelectionStation=COOPGIS_FormGeography.MoveStation(form, SelectionStation, UserNameOrIPAddress)
    OpenLayersZoom=COOPGIS_Ajax.GetOpenLayersZoom(SelectionStation, SelectionSpan)  #Get the Zoom before the span is deleted so area is not left on this refresh    
    StationDeleted=COOPGIS_FormGeography.DeleteStation(form, SelectionStation, UserNameOrIPAddress)
    COOPGIS_FormGeography.DeleteSpan(form, SelectionSpan, UserNameOrIPAddress)
    if(not StationDeleted):
        for assemblyFormNumber in range(0, 10):
            COOPGIS_FormAssembly.ProcessStationAssembly(form, assemblyFormNumber, SelectionStation, UserNameOrIPAddress, UpdateStakerWorkOrderIndicator=False, InventoryCollectionMode=True)
        for assemblyFormNumber in range(0, 3):
            COOPGIS_FormAssembly.ProcessSpanAssembly(form, assemblyFormNumber, SelectionSpan, UserNameOrIPAddress, UpdateStakerWorkOrderIndicator=False, InventoryCollectionMode=True)
        COOPGIS_FormInventoryCollection.ProcessShortcuts(form, Shortcuts, SelectionStation, UserNameOrIPAddress)
        COOPGIS_FormInventoryCollection.ProcessPoleRightOfWayStatus(form, SelectionStation, UserNameOrIPAddress)
        COOPGIS_FormInventoryCollection.ProcessPoleJointUse(form, SelectionStation, UserNameOrIPAddress)
        COOPGIS_FormInventoryCollection.ProcessPoleTreatment(form, SelectionStation, UserNameOrIPAddress)
        COOPGIS_FormInventoryCollection.ProcessDeleteAssembly(form, SelectionStation, SelectionSpan, UserNameOrIPAddress)
    COOPGIS_FormInventoryCollection.PopulateInventoryCollectionFormFields(form, Shortcuts, SelectionStation, SelectionSpan)
    COOPGIS_Misc.UpdateSelection(SelectionStation, SelectionSpan, UserNameOrIPAddress)
    StationAssemblyList, SpanAssemblyList = COOPGIS_Misc.GetNearbyInfo(SelectionStation, SelectionSpan)
    MapFileName, LayerName=COOPGIS_Misc.GenerateDynamicMapFile(ApplicationName, UserNameOrIPAddress)
    ShortcutList=list(Shortcuts)
    ShortcutList.sort()
    COOPGIS_DynamicTemplate.UpdateInventoryCollectionTemplate(ShortcutList, UserNameOrIPAddress)
    t = loader.get_template('/opt/coopgis/djangoproject/templates/inventorycollection' + UserNameOrIPAddress + '.html')
    c = Context({'OpenLayersZoom': OpenLayersZoom, 'form': form,
                 'StationAssemblyList': StationAssemblyList, 'SpanAssemblyList': SpanAssemblyList,
                 'GPSStatus': GPSStatus, 'GPSStatus2': GPSStatus2, 'GPSStatus3': GPSStatus3, 'MapFileName': MapFileName, 'LayerName': LayerName,})
    return HttpResponse(t.render(c))

def SetupShortcuts():
    Shortcuts={}  #Shortcuts keys are renedered as part of a django template tag name, so should not include '-', ' ', or other invalid characters 
    Shortcuts['E1_1Grp']=['E1-1', 'E3-10', 'F1-1S']
    Shortcuts['E1_2Grp']=['E1-2', 'E3-10', 'F1-2S']
    Shortcuts['E1_3Grp']=['E1-3', 'E3-10', 'F1-3S']
    Shortcuts['M2_1']=['M2-1']
    Shortcuts['M2_2']=['M2-2']
    Shortcuts['M2_11']=['M2-11']
    Shortcuts['M2_12']=['M2-12']
    Shortcuts['K14C']=['K14C']
    Shortcuts['K10C']=['K10C']
    Shortcuts['K17']=['K17']
    Shortcuts['M26_5']=['M26-5']
    Shortcuts['M5_27']=['M5-27']
    return Shortcuts










def InventoryCollectionAdmin(request):
    try:
        applicationPermission=bool('InventoryCollection' in str(request.user.groups.all()))
        UserName=str(request.user.username)
    except:
        applicationPermission=False
        UserName='Unknown'

    if request.user.is_anonymous():
        LoginStatus="You are not currently logged in.  Please login through the Main Menu."
        applicationPermission=False
    else:
        try:
            applicationPermission=bool('InventoryCollection' in str(request.user.groups.all()))
            UserName=str(request.user.username)
        except:
            applicationPermission=False
            UserName='Unknown'
        LoginStatus="Welcome to COOPGIS Inventory Collection, " + request.user.username + '.'
    if(not applicationPermission):
        if(not request.user.is_anonymous()):
            LoginStatus = LoginStatus + '  You do not have access rights to this page.'
        t = loader.get_template('/opt/coopgis/djangoproject/templates/inventorycollectionadmin.html')
        c = Context({'LoginStatus':  LoginStatus, 'inventoryCollectionAdminForm': inventoryCollectionAdminForm})
        return HttpResponse(t.render(c))
    if request.method == 'POST':
        inventoryCollectionAdminForm = InventoryCollectionAdminForm(request.POST)
    else:
        inventoryCollectionAdminForm = InventoryCollectionAdminForm()
        inventoryCollectionAdminForm.data['Name'] = ''
	inventoryCollectionAdminForm.data['Description'] = ''
        inventoryCollectionAdminForm.data['LaborHours'] = ''
        inventoryCollectionAdminForm.data['KVA'] = ''
        inventoryCollectionAdminForm.data['KVAR'] = ''
        inventoryCollectionAdminForm.data['MaximumContinousAmp'] = ''
        inventoryCollectionAdminForm.data['Wattage'] = ''
        inventoryCollectionAdminForm.data['Height'] = ''
        inventoryCollectionAdminForm.data['Class'] = ''
        inventoryCollectionAdminForm.data['CompatibleUnitCategory'] = ''
        inventoryCollectionAdminForm.data['InputVoltage'] = ''
        inventoryCollectionAdminForm.data['FirstOutputVoltage'] = ''
        inventoryCollectionAdminForm.data['SecondOutputVoltage'] = ''
        inventoryCollectionAdminForm.data['StationIndicator'] = False
        inventoryCollectionAdminForm.data['SpanIndicator'] = False
        inventoryCollectionAdminForm.data['ConductorIndicator'] = False
        inventoryCollectionAdminForm.data['ConduitIndicator'] = False
        inventoryCollectionAdminForm.data['SpanGuyIndicator'] = False
        inventoryCollectionAdminForm.data['CapacitorIndicator'] = False
        inventoryCollectionAdminForm.data['CutOutIndicator'] = False
        inventoryCollectionAdminForm.data['FeederIndicator'] = False
        inventoryCollectionAdminForm.data['GroundIndicator'] = False
        inventoryCollectionAdminForm.data['LightIndicator'] = False
        inventoryCollectionAdminForm.data['LightningArrestorIndicator'] = False
        inventoryCollectionAdminForm.data['OpenPointIndicator'] = False
        inventoryCollectionAdminForm.data['VaultIndicator'] = False
        inventoryCollectionAdminForm.data['MiscellaneousEquipmentIndicator'] = False
        inventoryCollectionAdminForm.data['PoleIndicator'] = False
        inventoryCollectionAdminForm.data['RecloserIndicator'] = False
        inventoryCollectionAdminForm.data['MeterIndicator'] = False
        inventoryCollectionAdminForm.data['SubstationIndicator'] = False
        inventoryCollectionAdminForm.data['SwitchIndicator'] = False
        inventoryCollectionAdminForm.data['TransformerIndicator'] = False
        inventoryCollectionAdminForm.data['StakerPoleIndicator'] = False
        inventoryCollectionAdminForm.data['StakerTransformerIndicator'] = False
        inventoryCollectionAdminForm.data['StakerMiscEquipmentIndicator'] = False
        inventoryCollectionAdminForm.data['StakerGroundIndicator'] = False
        inventoryCollectionAdminForm.data['StakerGuyGuyIndicator'] = False
        inventoryCollectionAdminForm.data['StakerGuyMarkerIndicator'] = False
        inventoryCollectionAdminForm.data['StakerGuyAnchorIndicator'] = False
        inventoryCollectionAdminForm.data['StakerUnitIndicator'] = False
        inventoryCollectionAdminForm.data['StakerSpanAssemblyIndicator'] = False
    #Check to see if a new compatible unit should be created
    if(inventoryCollectionAdminForm.data['Name']):
        Name=inventoryCollectionAdminForm.data['Name']
        Description=inventoryCollectionAdminForm.data['Description']
        try:
            LaborHours=float(inventoryCollectionAdminForm.data['LaborHours'])
        except:
            LaborHours = 0
        try: 
            KVA=float(KVAinventoryCollectionAdminForm.data['KVA'])
        except:
            KVA=None
        try: 
            KVAR=float(KVARinventoryCollectionAdminForm.data['KVAR'])
        except:
            KVAR=None
        try:
            MaximumContinousAmp=float(inventoryCollectionAdminForm.data['MaximumContinousAmp'])
        except:
            MaximumContinousAmp=None
        try:
            Wattage=float(inventoryCollectionAdminForm.data['Wattage'])
        except:
            Wattage=None
        Height=inventoryCollectionAdminForm.data['Height']
        Class=inventoryCollectionAdminForm.data['Class']
        try:
            compatibleUnitCategory=CompatibleUnitCategory.objects.filter(id=inventoryCollectionAdminForm['CompatibleUnitCategory'])[0]
            CompatibleUnitCategoryid=compatibleUnitCategory.id
        except:
            compatibleUnitCategory=None
            CompatibleUnitCategoryid=None
        try:
            inputVoltage=Voltage.objects.filter(id=inventoryCollectionAdminForm.data['InputVoltage'])[0]
            InputVoltageid=inputVoltage.id
        except:
            inputVoltage=None
            InputVoltageid=None
        try:
            firstOutputVoltage=Voltage.objects.filter(id=inventoryCollectionAdminForm.data['FirstOutputVoltage'])[0]
            FirstOutputVoltageid=firstOutputVoltage.id
        except:
            firstOutputVoltage=None
            FirstOutputVoltageid=None
        try:
            secondOutputVoltage=Voltage.objects.filter(id=inventoryCollectionAdminForm.data['secondOutputVoltage'])[0]
            SecondOutputVoltageid=secondOutputVoltage.id
        except:
            secondOutputVoltage=None
            SecondOutputVoltageid=None
        try:
            StationIndicator=bool(inventoryCollectionAdminForm.data['StationIndicator'] == 'on')
        except:
            StationIndicator=False
        try:
            SpanIndicator=bool(inventoryCollectionAdminForm.data['SpanIndicator'] == 'on')
        except:
            SpanIndicator=False
        try:
            ConductorIndicator=bool(inventoryCollectionAdminForm.data['ConductorIndicator'] == 'on')
        except:
            ConductorIndicator=False
        try:
            ConduitIndicator=bool(inventoryCollectionAdminForm.data['ConduitIndicator'] == 'on')
        except:
            ConduitIndicator=False
        try:
            SpanGuyIndicator=bool(inventoryCollectionAdminForm.data['SpanGuyIndicator'] == 'on')
        except:
            SpanGuyIndicator=False
        try:
            CapacitorIndicator=bool(inventoryCollectionAdminForm.data['CapacitorIndicator'] == 'on')
        except:
            CapacitorIndicator=False
        try:
            CutOutIndicator=bool(inventoryCollectionAdminForm.data['CutOutIndicator'] == 'on')
        except:
            CutOutIndicator=False
        try:
            FeederIndicator=bool(inventoryCollectionAdminForm.data['FeederIndicator'] == 'on')
        except:
            FeederIndicator=False
        try:
            GroundIndicator=bool(inventoryCollectionAdminForm.data['GroundIndicator'] == 'on')
        except:
            GroundIndicator=False
        try:
            LightIndicator=bool(inventoryCollectionAdminForm.data['LightIndicator'] == 'on')
        except:
            LightIndicator=False
        try:
            LightningArrestorIndicator=bool(inventoryCollectionAdminForm.data['LightningArrestorIndicator'] == 'on')
        except:
            LightningArrestorIndicator=False
        try:
            OpenPointIndicator=bool(inventoryCollectionAdminForm.data['OpenPointIndicator'] == 'on')
        except:
            OpenPointIndicator=False
        try:
            VaultIndicator=bool(inventoryCollectionAdminForm.data['VaultIndicator'] == 'on')
        except:
            VaultIndicator=False
        try:
            MiscellaneousEquipmentIndicator=bool(inventoryCollectionAdminForm.data['MiscellaneousEquipmentIndicator'] == 'on')
        except:
            MiscellaneousEquipmentIndicator=False
        try:
            PoleIndicator=bool(inventoryCollectionAdminForm.data['PoleIndicator'] == 'on')
        except:
            PoleIndicator=False
        try:
            RegulatorIndicator=bool(inventoryCollectionAdminForm.data['RegulatorIndicator'] == 'on')
        except:
            RegulatorIndicator=False
        try:
            RecloserIndicator=bool(inventoryCollectionAdminForm.data['RecloserIndicator'] == 'on')
        except:
            RecloserIndicator=False
        try:
            MeterIndicator=bool(inventoryCollectionAdminForm.data['MeterIndicator'] == 'on')
        except:
            MeterIndicator=False
        try:
            SubstationIndicator=bool(inventoryCollectionAdminForm.data['SubstationIndicator'] == 'on')
        except:
            SubstationIndicator=False
        try:
            SwitchIndicator=bool(inventoryCollectionAdminForm.data['SwitchIndicator'] == 'on')
        except:
            SwitchIndicator=False
        try:
            TransformerIndicator=bool(inventoryCollectionAdminForm.data['TransformerIndicator'] == 'on')
        except:
            TransformerIndicator=False
        try:
            StakerPoleIndicator=bool(inventoryCollectionAdminForm.data['StakerPoleIndicator'] == 'on')
        except:
            StakerPoleIndicator=False
        try:
            StakerTransformerIndicator=bool(inventoryCollectionAdminForm.data['StakerTransformerIndicator'] == 'on')
        except:
            StakerTransformerIndicator=False 
        try:
            StakerMiscEquipmentIndicator=bool(inventoryCollectionAdminForm.data['StakerMiscEquipmentIndicator'] == 'on')
        except:
            StakerMiscEquipmentIndicator=False
        try:
            StakerGroundIndicator=bool(inventoryCollectionAdminForm.data['StakerGroundIndicator'] == 'on')
        except:
            StakerGroundIndicator=False
        try:
            StakerGuyGuyIndicator=bool(inventoryCollectionAdminForm.data['StakerGuyGuyIndicator'] == 'on')
        except:
            StakerGuyGuyIndicator=False
        try:
            StakerGuyMarkerIndicator=bool(inventoryCollectionAdminForm.data['StakerGuyMarkerIndicator'] == 'on')
        except:
            StakerGuyMarkerIndicator=False
        try:
            StakerGuyAnchorIndicator=bool(inventoryCollectionAdminForm.data['StakerGuyAnchorIndicator'] == 'on')
        except:
            StakerGuyAnchorIndicator=False
        try:
            StakerUnitIndicator=bool(inventoryCollectionAdminForm.data['StakerUnitIndicator'] == 'on')
        except:
            StakerUnitIndicator=False
        try:
            StakerSpanAssemblyIndicator=bool(inventoryCollectionAdminForm.data['StakerSpanAssemblyIndicator'] == 'on')
        except:
            StakerSpanAssemblyIndicator=False

        command=Command()
        command=command.Create(Name='CreateCompatibleUnit', CompatibleUnitName=Name, Description=Description, CompatibleUnitCategoryid=CompatibleUnitCategoryid, 
                    KVA=KVA, KVAR=KVAR, InputVoltageid=InputVoltageid, FirstOutputVoltageid=FirstOutputVoltageid, SecondOutputVoltageid=SecondOutputVoltageid,
                    MaximumContinousAmp=MaximumContinousAmp, Wattage=Wattage,
                    Height=Height, Class=Class, LaborHours=LaborHours, StationIndicator=StationIndicator, SpanIndicator=SpanIndicator,
                    ConductorIndicator=ConductorIndicator, ConduitIndicator=ConduitIndicator,
                    CapacitorIndicator=CapacitorIndicator, CutOutIndicator=CutOutIndicator, FeederIndicator=FeederIndicator, 
                    GroundIndicator=GroundIndicator, LightIndicator=LightIndicator, LightningArrestorIndicator=LightningArrestorIndicator,
                    OpenPointIndicator=OpenPointIndicator, 
                    MiscellaneousEquipmentIndicator=MiscellaneousEquipmentIndicator, PoleIndicator=PoleIndicator,
                    RecloserIndicator=RecloserIndicator, RegulatorIndicator=RegulatorIndicator, 
                    MeterIndicator=MeterIndicator, SpanGuyIndicator=SpanGuyIndicator,
                    SubstationIndicator=SubstationIndicator, SwitchIndicator=SwitchIndicator,
                    TransformerIndicator=TransformerIndicator, VaultIndicator=VaultIndicator,
                    StakerPoleIndicator=StakerPoleIndicator, 
                    StakerTransformerIndicator=StakerTransformerIndicator, StakerMiscEquipmentIndicator=StakerMiscEquipmentIndicator,
                    StakerGroundIndicator=StakerGroundIndicator, StakerGuyGuyIndicator=StakerGuyGuyIndicator, StakerGuyMarkerIndicator=StakerGuyMarkerIndicator,
                    StakerGuyAnchorIndicator=StakerGuyAnchorIndicator, CommandUserName=UserName, CommandReadyToProcessIndicator=True,
                    StakerUnitIndicator=StakerUnitIndicator, StakerSpanAssemblyIndicator=StakerSpanAssemblyIndicator)
        command.Process()
    #Build the Webpage
    t = loader.get_template('/opt/coopgis/djangoproject/templates/inventorycollectionadmin.html')
    c = Context({'LoginStatus':  LoginStatus, 'inventoryCollectionAdminForm': inventoryCollectionAdminForm})
    return HttpResponse(t.render(c))











class InventoryCollectionAdminForm(forms.Form):
    Name=forms.CharField()
    Description=forms.CharField(required=False)
    CompatibleUnitCategoryChoices=[]
    CompatibleUnitCategories=CompatibleUnitCategory.objects.all().order_by('Name')
    CompatibleUnitCategoryChoices.append(['-1', 'None'])
    for i in CompatibleUnitCategories:
        CompatibleUnitCategoryChoices.append([i.id, str(i)])
    CompatibleUnitCategory=forms.ChoiceField(choices=CompatibleUnitCategoryChoices, required=False)
    LaborHours=forms.FloatField(required=False)   
    #The following fields are specific to electric equipment    
    KVA=forms.FloatField(required=False)
    KVAR=forms.FloatField(required=False)
    VoltageChoices=[]
    Voltages=Voltage.objects.all().order_by('Name')
    VoltageChoices.append(['-1', 'None'])
    for i in Voltages:
        VoltageChoices.append([i.id, str(i)])
    InputVoltage=forms.ChoiceField(choices=VoltageChoices)
    FirstOutputVoltage=forms.ChoiceField(choices=VoltageChoices)
    SecondOutputVoltage=forms.ChoiceField(choices=VoltageChoices)
    MaximumContinousAmp=forms.FloatField(required=False)
    Wattage=forms.FloatField(required=False)
    #The following are specific to Poles (or possibly other equipment with heights)
    Height=forms.CharField(required=False)
    Class=forms.CharField(required=False)
    #The following fields identify whether a compatible unit should be placed in a Span or Station
    StationIndicator=forms.BooleanField(required=False)
    SpanIndicator=forms.BooleanField(required=False)
    #The following fields identify Compatible Unit Categories
    #What function a device does is defined by these fields
    #SpanAssemblies:
    ConductorIndicator=forms.BooleanField(required=False)
    ConduitIndicator=forms.BooleanField(required=False)
    SpanGuyIndicator=forms.BooleanField(required=False)
    #StationAssemblies:
    CapacitorIndicator=forms.BooleanField(required=False)
    CutOutIndicator=forms.BooleanField(required=False)
    FeederIndicator=forms.BooleanField(required=False)
    GroundIndicator=forms.BooleanField(required=False)
    LightIndicator=forms.BooleanField(required=False)
    LightningArrestorIndicator=forms.BooleanField(required=False)
    OpenPointIndicator=forms.BooleanField(required=False)
    VaultIndicator=forms.BooleanField(required=False)  #Includes Underground Stations (secondary vaults and pedestals)
    MiscellaneousEquipmentIndicator=forms.BooleanField(required=False)
    PoleIndicator=forms.BooleanField(required=False)
    RecloserIndicator=forms.BooleanField(required=False)
    RegulatorIndicator=forms.BooleanField(required=False)
    MeterIndicator=forms.BooleanField(required=False)
    SubstationIndicator=forms.BooleanField(required=False)
    SwitchIndicator=forms.BooleanField(required=False)
    TransformerIndicator=forms.BooleanField(required=False)
    #The following fields identify Compatible Unit Staker Categories
    #This unambigiously defines where an assembly will appear in a Staker Report
    #These do not determine how an assembly connects to other assemblies
    StakerPoleIndicator=forms.BooleanField(required=False)
    StakerTransformerIndicator=forms.BooleanField(required=False)
    StakerMiscEquipmentIndicator=forms.BooleanField(required=False)
    StakerGroundIndicator=forms.BooleanField(required=False)
    StakerGuyGuyIndicator=forms.BooleanField(required=False)
    StakerGuyMarkerIndicator=forms.BooleanField(required=False)
    StakerGuyAnchorIndicator=forms.BooleanField(required=False)
    StakerUnitIndicator=forms.BooleanField(required=False)
    StakerSpanAssemblyIndicator=forms.BooleanField(required=False)



